function steps = runonce(w)
projectPath = '/Users/qhsu/Documents/workspace/RobotSimLog3';
javaaddpath(strcat(projectPath, '/bin'));

configName = 'config';

steps = 0;

for i=1:1
    for j=0:0
        myConfigName = strcat(configName,'_',num2str(i),'_',num2str(j));
        configStr = java.lang.String(myConfigName);
        for k=1:5 % try five times max
            thisSteps = sim.Sim.runOnce(configStr, w(1), w(2), w(3),w(4));
            if (thisSteps >= 0)
                break;
            end
        end
        if (thisSteps < 0) 		% if we get to this point, the for loop
            thisSteps = 50000;	% has broken, test to see we got a positive
        end                		% result, otherwise add zero to steps
        steps = steps + thisSteps;
    end
end